using UnityEngine;
using System.Collections;

public class ChangeDrag : CharacterAction
{
	public float targetDrag = 1;

	protected float lastDrag;

	public override void OnActionEnter(Character character)
	{ 
		lastDrag = character.rigidbodyRef.drag;
		character.rigidbodyRef.drag = targetDrag;
	}
	
	
	/** override to implement, and unregister event hanlders here*/
	public override void OnActionExit(Character character)
	{  
		if(character.rigidbodyRef.drag != targetDrag)
		{
			Debug.LogWarning("ChangeDrag: target drag changed by other action");
		}

		character.rigidbodyRef.drag = lastDrag;
	}
 
}

